<template>
  <view>
    <view class="main-head">
      <view class="title-h3">{{ details.positionName || "" }}</view>
      <view class="price-wall">
        <view class="flex1">
          <text class="tag">{{ details.positionTypeLabel || "" }}</text>
        </view>
        <view class="price-text">¥
          <text class="price-strong" v-if="positionType1">{{
            details.startSalary || ""
          }}</text>
          <text class="price-strong" v-else>{{ details.startSalary || "" }}-{{ details.endSalary || "" }}</text>
          /{{ details.salaryPeriodLabel || "" }}
        </view>
      </view>
      <view class="num-wall">
        <view class="num-item">
          <view class="strong">{{ details.recruitmentCount || 0 }}</view>
          <view>招聘人数</view>
        </view>
        <view class="num-item">
          <view class="strong">{{ details.applyCount || 0 }}</view>
          <view>申请人数</view>
        </view>
        <view class="num-item">
          <view class="strong">{{ details.employCount || 0 }}</view>
          <view>已录用人数</view>
        </view>
      </view>
      <view class="state-bar">
        <view class="state">招聘中</view>
        <view class="time">
          <image class="time-icon" src="@/static/images/form/text.png" />
          {{ details.shelfTime || "" }}
        </view>
      </view>
    </view>
    <!-- tab导航 -->
    <view class="tabNav-wall tabNavH">
      <scroll-view class="tabNav" scroll-x="true" scroll-left="0">
        <view v-for="(item, index) in typeList" :key="item.id" @click="tabIndexFn(index, item.id)" class="tabNav-item"
          :class="{ active: tabIndex === index }">
          {{ item.categoryName }}
          <image class="tabNav-icon" src="@/static/images/recruit/wan.png" />
        </view>
      </scroll-view>
      <!-- 功能操作栏 -->
      <view class="operate-wall" v-if="tabIndex === 1 || tabIndex === 3">
        <template v-if="batchStatus">
          <view class="operate-item" @click="batchFn(false)">退出批量操作</view>
          <view class="operate-item" @click="checkboxAllFn" :class="{ active: checkboxIds.length === list.length }">全选
          </view>
        </template>
        <view class="operate-item" @click="batchFn(true)" v-else>
          <image class="operate-icon" src="@/static/images/form/batch.png" />
          批量操作
        </view>
      </view>
    </view>

    <!-- 列表内容 -->
    <scroll-view scroll-y class="scroll-main" @scrolltolower="scrollBottomFn">
      <!-- 功能操作栏高度 -->
      <view class="operate-wallH" v-if="tabIndex === 1 || tabIndex === 3"></view>

      <view class="list">
        <view class="label-item" v-for="item in list" :key="item.seekerLogId">
          <view v-if="batchStatus" class="checkbox" :class="{ active: checkboxIds.includes(item.seekerLogId) }"
            @click="checkboxFn(item.seekerLogId, item.positionId)"></view>
          <view class="list-item">
            <view class="top-box" @click="goDetail(item)">
              <view class="left-item">
                <view class="image">
                  <image :src="item.avatar"></image>
                </view>
                <view class="desc-box">
                  <view class="t-desc">
                    <view class="name">{{ item.name || "-" }}</view>
                    <view class="icon">
                      <image :src="
                        item.sex == '女'
                          ? 'http://wangxinbao.oss-cn-beijing.aliyuncs.com/2024/04/09/5285d5d3bab744009c3ab3a9a243f8de.png'
                          : 'http://wangxinbao.oss-cn-beijing.aliyuncs.com/2024/04/09/6645a9716ba349119fe1fbd3e4b8ada5.png'
                      " />
                    </view>
                    <view class="status" :class="{ active: item.verifyStatus === '1' }">
                      {{ item.verifyStatus === "1" ? "已实名" : "未实名" }}
                    </view>
                  </view>
                  <view class="b-desc">
                    <view class="text">{{ item.age || "-" }}岁
                      <text style="padding: 0 4rpx"> |</text>
                    </view>
                    <view class="text">{{ item.education || "-" }}
                      <text style="padding: 0 4rpx"> |</text>
                    </view>
                    <view class="text">{{ item.workExperience || "-" }}年经验</view>
                  </view>
                </view>
              </view>

              <view class="right-item ellipsis1">
                <view class="label">
                  <text class="" selectable="false" space="false" decode="false">
                    {{ item.jobType || "-" }}
                  </text>
                </view>
                <view style="height: 42rpx; margin-bottom: 15rpx"> </view>
                <view class="address">{{ item.city || "-" }}</view>
              </view>
            </view>
            <view class="line"></view>

            <view class="bottom-box">
              <view class="b-left">
                <text class="one">意向</text>
                <text class="tow">{{ item.postName || "-" }}</text>
              </view>
              <view class="b-right">
                <text class="symbol">¥</text>
                <text class="money">{{ item.salary || "-" }}</text>
              </view>
            </view>
            <view class="bottom-btn">
              <view class="flex1">
                <text class="text1">{{ statusOption[item.status] }}</text>
              </view>
              <!-- 状态 (1=已拒绝,2=已录用,3=已到岗,4=未到岗,5=已取消 6=待评价 7=已评价) -->
              <view class="btn1" v-if="item.status == '0' && !positionType1" @click="statusChange('2', item.seekerLogId)">
                录用</view>
              <view class="btn1" v-if="item.status == '0' && positionType1" @click="openPayDialog(item)">录用</view>
              <view class="btn1" v-if="item.status == '0'" @click="statusChange('1', item.seekerLogId)">拒绝</view>
              <view class="btn1" v-if="item.status == '1' && !positionType1" @click="statusChange('2', item.seekerLogId)">
                改为录用</view>
              <view class="btn1" v-if="item.status == '1' && positionType1" @click="openPayDialog(item)">改为录用</view>
              <template v-if="item.status == '2'">
                <view class="btn1" @click="statusChange('1', item.seekerLogId)" v-if="details.positionType !== '1'">取消录用
                </view>
                <view class="btn1" @click="workOpen(item.seekerLogId, item.positionId)" v-if="details.positionType !== '1'">已到岗
                </view>
                <view class="btn1" @click="statusChange('4', item.seekerLogId)" v-if="details.positionType !== '1'">未到岗
                </view>
                <view class="btn1" @click="statusChange('8', item.seekerLogId)" v-if="details.positionType === '1'">已到场
                </view>
              </template>
              <template v-if="item.status == '8'">
                <view class="btn1" @click="workOpen(item.seekerLogId, item.positionId)">{{
                  positionType1 ? "确定完工" : "已到岗"
                }}</view>
                <view class="btn1" @click="statusChange('4', item.seekerLogId)" v-if="details.positionType !== '1'">{{
                  positionType1 ? "未完工"
                  :
                  "未到岗" }}</view>
              </template>
              <view class="btn1" v-if="item.status == '6' || item.status == '7'" @click="workOpen2(item)">{{ positionType1
                ? "完工记录" : "到岗记录" }}</view>
              <view class="btn1" v-if="
                item.status == '4'
              " @click="workOpen(item.seekerLogId, item.positionId)">已到岗</view>
              <view class="btn1" v-if="
                item.status == '2' || item.status == '3' || item.status == '4'
              " @click="callPhone(item.mobile)">联系</view>

              <view class="btn1" v-if="item.status == '6'" @click="NowEvaluate(item.seekerLogId)">立即评价</view>
              <view class="btn1" v-if="item.status == '7'" @click="NowEvaluate(item.seekerLogId, true)">查看评价</view>
            </view>
          </view>
        </view>
      </view>

      <uni-load-more :status="loading" />
      <view class="footer-operateH" v-if="batchStatus"></view>
    </scroll-view>

    <!-- 底部操作栏 -->
    <view class="footer-operate" v-if="batchStatus">
      <view class="flex1">
        <view class="footer-text">已选({{ checkboxIds.length }})</view>
      </view>
      <template v-if="form.status == '0'">
        <view class="footer-btn" @click="statusChange('1')">拒绝</view>
        <view v-if="positionType1" class="footer-btn active" @click="openPayDialog()">录用</view>
        <view v-else class="footer-btn active" @click="statusChange('2')">录用</view>
      </template>
      <template v-if="form.status == '1'">
        <view v-if="positionType1" class="footer-btn active" @click="openPayDialog()">改为录用</view>
        <view v-else class="footer-btn active" @click="statusChange('2')">改为录用</view>
      </template>
      <template v-if="form.status == '2'">
        <!-- <view class="footer-btn" @click="statusChange('1')">取消录用</view> -->
        <view class="footer-btn" @click="statusChange('4')">{{
          positionType1 ? "未完工" : "未到岗"
        }}</view>
        <view class="footer-btn active" @click="workOpen()">{{
          positionType1 ? "确定完工" : "已到岗"
        }}</view>
      </template>
    </view>

    <!-- 到场确认弹窗 -->
    <uni-popup ref="confirmPopup" type="center" border-radius="10px 10px 0 0" @change="closePop">
      <view class="confirmBox">
        <view class="top">到场确认</view>
        <view class="middle">短信验证码已发给求职者。
          请在求职者到场后，向求职者索取验证码。</view>
        <div class="input">
          <input type="text" v-model="messageCode">
        </div>
        <view class="btn">
          <view class="cancel" @click="cancelHere">取消</view>
          <view class="confirm" @click="confirmHere">确认</view>
        </view>
      </view>
    </uni-popup>

    <!-- 到岗弹窗 -->
    <uni-popup ref="workPopup" type="center" border-radius="10px 10px 0 0" @change="closePop">
      <view class="dialog">
        <view class="dialogTop">
          <view class="title">{{
            positionType1 ? "完工记录" : "到岗记录"
          }}</view>
          <view class="close" @click="workClose">
            <image class="image" src="@/static/images/emterpriseVip/close.png" mode="aspectFit|aspectFill|widthFix"
              lazy-load="false" binderror="" bindload="" />
          </view>
        </view>

        <image v-if="workUrl !== ''" class="workUrl" :src="workUrl" mode="aspectFit" />
        <view v-else style="width: 180px; height: 180px; margin: 60rpx auto 80rpx">
          <upload-img @change="uploadImgFn" @start="startUpload" :limit="1" :imageStyles="imageStyles" :value="fileList">
            <image style="width: 100%; height: 100%; flex-shrink: 0"
              src="http://wangxinbao.oss-cn-beijing.aliyuncs.com/2024/04/18/514bd029aaa046e3a4749a6191d54ebd.png"
              mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload="" />
          </upload-img>
        </view>

        <view class="btn" v-if="workUrl == ''">
          <view class="later" selectable="false" space="false" decode="false" @click="workClose">
            取消
          </view>
          <view v-if="uploadStatu" @click="statusChange('3')" class="finish" selectable="false" space="false"
            decode="false">
            确定
          </view>
          <view v-else class="finish" selectable="false" space="false" decode="false">
            待上传
          </view>
        </view>
      </view>
    </uni-popup>

    <!-- 评价弹窗 -->
    <uni-popup ref="commentPopup" type="center" border-radius="10px 10px 0 0">
      <view class="dialog">
        <view class="dialogTop">
          <view class="title">评价详情 </view>

          <view class="close" @click="close">
            <image class="image" src="@/static/images/emterpriseVip/close.png" mode="aspectFit|aspectFill|widthFix"
              lazy-load="false" binderror="" bindload="" />
          </view>
        </view>

        <view class="content">
          <view style="font-size: 32rpx;margin-bottom: 20rpx;">企业评价</view>
          <view v-if="evaluateDetail" class="text" style="padding-bottom: 10rpx">
            你对当前求职者还满意吗？
          </view>
          <view v-else class="text" style="padding-bottom: 10rpx">
            求职者评分
          </view>
          <uni-rate v-model="evaluateForm.score" @change="onChangeRate" :size="45" />
          <view class="text" style="padding: 20rpx 0"> 评价内容 </view>
          <view v-if="evaluateDetail" class="textarea-text">{{
            evaluateForm.remark
          }}</view>
          <view v-else class="textarea">
            <textarea @input="sumFontNum" v-model="evaluateForm.remark" placeholder="请填写评价内容..." :maxlength="300"
              style="padding: 20rpx 0 0 20rpx" />
            <view class="textarea-num"><text>{{ fontNum }}</text>/300</view>
          </view>
        </view>
        <view class="content" style="margin-top: 60rpx;" v-if="evaluateDetail">
          <view style="font-size: 32rpx;margin-bottom: 20rpx;">求职者评价</view>
          <view v-if="evaluateForm.score1 && evaluateForm.remark1">
            <view v-if="evaluateDetail" class="text" style="padding-bottom: 10rpx">
              你对当前求职者还满意吗？
            </view>
            <view v-else class="text" style="padding-bottom: 10rpx">
              求职者评分
            </view>
            <uni-rate v-model="evaluateForm.score1" @change="onChangeRate" :size="45" />
            <view class="text" style="padding: 20rpx 0"> 评价内容 </view>
            <view v-if="evaluateDetail" class="textarea-text">{{
              evaluateForm.remark1
            }}</view>
            <view v-else class="textarea">
              <textarea @input="sumFontNum" v-model="evaluateForm.remark" placeholder="请填写评价内容..." :maxlength="300"
                style="padding: 20rpx 0 0 20rpx" />
              <view class="textarea-num"><text>{{ fontNum }}</text>/300</view>
            </view>
          </view>
          <view style="margin-top: 40rpx;" v-else>求职者未评价~</view>
        </view>
        <view class="btn" v-if="!evaluateDetail" style="padding-top: 70rpx">
          <view class="later" selectable="false" space="false" decode="false" @click="close">
            取消
          </view>
          <view @click="commentFn('6')" class="finish" selectable="false" space="false" decode="false">
            提交
          </view>
        </view>
      </view>
    </uni-popup>
    <!-- 支付确认弹窗 -->
    <uni-popup ref="confirmPay" type="center" border-radius="10px 10px 0 0">
      <view class="payPopup">
        <view class="p_contain">
          <view class="c_header">
            <text>支付确认</text>
            <view class="closePay" @click="closePayDialog">
              <image class="image" src="@/static/images/emterpriseVip/close.png" mode="aspectFit|aspectFill|widthFix"
                lazy-load="false" binderror="" bindload="" />
            </view>
          </view>
          <view class="c_item">
            <text>岗位</text>
            <text>{{ details.positionName }}</text>
          </view>
          <view class="c_item">
            <text>薪酬</text>
            <text>￥{{ Number(details.startSalary) }}</text>
          </view>
          <view class="c_item">
            <text>支付总人数</text>
            <text>{{ Number(seekerLogIdArr.length) }}</text>
          </view>
          <view class="c_item c_hide">
            <text>平台服务费</text>
            <text>￥{{ (Math.round(details.startSalary * 100 * 0.15 * seekerLogIdArr.length) / 100).toFixed(2) }}</text>
          </view>
          <view class="c_item">
            <text>支付金额</text>
            <text>￥{{ (Math.round(details.startSalary * 100 * seekerLogIdArr.length * 1.15) / 100).toFixed(2) }}</text>
          </view>
          <view class="c_confirm" @click="handlePay">立即支付</view>
        </view>
      </view>
    </uni-popup>
  </view>
</template>

<script>
import uploadImg from "@/components/uploadImg/uploadImg";
import {
  getRecruitInfo,
  getJobSeekerLogInfo,
  exitRecruitsPosition,
  evaluate,
  getScoreInfo,
  creationOrder,
  xcxNotify,
  transactions,
} from "@/api/subPage/post.js";
export default {
  components: { uploadImg },
  data() {
    return {
      imageStyles: {
        width: 180,
        height: 180,
        border: false, // 是否显示边框
      },
      tabIndex: 0,
      // 状态 (1=已拒绝,2=已录用,3=已到岗,4=未到岗,5=已取消 6=待评价 7=已评价)
      typeList: [
        { id: "100", categoryName: "全部" },
        { id: "0", categoryName: "已申请" },
        { id: "1", categoryName: "不录用" },
        { id: "2", categoryName: "已录用" },
        { id: "3", categoryName: "已到岗" },
        { id: "4", categoryName: "未到岗" },
        // { id: "5", categoryName: "已取消" },
        { id: "6", categoryName: "待评价" },
        { id: "7", categoryName: "已评价" },
      ],
      // // 零工的导航栏
      // typeList2: [
      //   { id: "100", categoryName: "全部" },
      //   { id: "0", categoryName: "已申请" },
      //   { id: "1", categoryName: "不录用" },
      //   { id: "2", categoryName: "已录用" },
      //   { id: "3", categoryName: "已完工" },
      //   { id: "4", categoryName: "未完工" },
      //   // { id: "5", categoryName: "已取消" },
      //   { id: "6", categoryName: "待评价" },
      //   { id: "7", categoryName: "已评价" },
      // ],
      statusOption: [
        "已申请",
        "不录用",
        "已录用",
        "已到岗",
        "未到岗",
        "已取消",
        "待评价",
        "已评价",
      ],

      details: {},
      list: [],
      pages: 1, //当前分页总页数
      loading: "more", //加载状态
      form: {
        pageSize: 10, //pageSize 每页大小
        pageNum: 1, // pageNum 页数
        status: "", // 状态
        positionId: "",
        seekerLogId: []
      },
      hereSeekerLogId: '',
      messageCode: '', // 到场验证码
      batchStatus: false, // 批量操作状态
      checkboxIds: [],

      fileList: [],
      workUrl: "",

      // 立即评价
      evaluateForm: {
        seekerLogId: [],
        score: 0,
        score1: 0,
        remark: "",
        remark1: "",
      },
      evaluateDetail: false,
      // 字数
      fontNum: 0,
      uploadStatu: false,
      seekerLogIdArr: [],
      orderInfo: {}
    };
  },
  computed: {
    positionType1() {
      let type = this.details.positionType === "1" ? true : false;
      return type;
    },
  },
  // 监控data中的数据变化
  watch: {},
  onLoad(options) {
    this.form.positionId = options.id;
    this.getInfo();
    this.getListFn();
  },
  onShow() { },
  onReady() { },
  methods: {
    //打开立即支付弹窗
    openPayDialog(item) {
      this.seekerLogIdArr = item ? [item.seekerLogId] : this.checkboxIds;
      console.log(this.seekerLogIdArr);
      if (this.seekerLogIdArr.length == 0) {
        uni.showToast({
          title: "请选择简历",
          icon: "none",
          duration: 2000,
        });
        return true;
      }
      this.$refs.confirmPay.open();
    },
    //关闭立即支付弹窗
    closePayDialog() {
      this.$refs.confirmPay.close();
    },
    // 立即支付
    handlePay() {
      let that = this;
      let serviceMoney = Number(this.details.startSalary * 0.15) * this.seekerLogIdArr.length
      let totalMoney = Number(this.details.startSalary * 1.15) * this.seekerLogIdArr.length
      console.log(serviceMoney, totalMoney);
      let form = {
        positionId: this.form.positionId,
        seekerLogId: this.seekerLogIdArr,
        totalMoney: totalMoney,
        serviceMoney: serviceMoney
      };
      creationOrder(form).then((res) => {
        let { nonceStr, packageStr, paySign, rechargeId, signType, timeStamp } =
          res.data;
        form.rechargeId = rechargeId;
        wx.requestPayment({
          timeStamp,
          nonceStr,
          package: packageStr,
          signType,
          rechargeId,
          paySign,
          success(res) {
            console.log(res);
            // that.statusChange(value, item.seekerLogId)
            transactions(form).then((res) => {
              console.log(res);
              that.checkboxIds = [];
              that.pages = 1;
              that.getListFn(1);
              that.$refs.confirmPay.close();
            });
          },
          fail(res) {
            console.log(res);
          },
        });
      });
    },
    closePop(e) {
      console.log('vue', e);
      this.uploadStatu = false;
    },
    startUpload() {
      this.uploadStatu = false;
    },
    // 支付
    playFn(item) {
      let that = this;
      let seekerLogIdArr = item ? [item.seekerLogId] : this.checkboxIds;
      if (seekerLogIdArr.length == 0) {
        uni.showToast({
          title: "请选择简历",
          icon: "none",
          duration: 2000,
        });
        return true;
      }
      let form = {
        positionId: this.form.positionId,
        seekerLogId: seekerLogIdArr,
      };
      creationOrder(form).then((res) => {
        let { nonceStr, packageStr, paySign, rechargeId, signType, timeStamp } =
          res.data;
        form.rechargeId = rechargeId;
        wx.requestPayment({
          timeStamp,
          nonceStr,
          package: packageStr,
          signType,
          rechargeId,
          paySign,
          success(res) {
            console.log(res);
            // that.statusChange(value, item.seekerLogId)
            transactions(form).then((res) => {
              console.log(res);
              that.checkboxIds = [];
              that.pages = 1;
              that.getListFn(1);
            });
          },
          fail(res) {
            console.log(res);
          },
        });
      });
    },
    // 上传图片监听
    uploadImgFn(data) {
      this.fileList = data.map((v) => v.url);
      console.log(this.fileList);
      this.fileList.length === 0 ? this.uploadStatu = false : this.uploadStatu = true
    },
    // 批量修改状态
    statusChange(value, seekerLogId) {
      if (value === '8') {
        this.$refs.confirmPopup.open();
        this.hereSeekerLogId = seekerLogId
        return
      }
      console.log(this.checkboxIds);
      this.seekerLogIdArr = seekerLogId ? [seekerLogId] : this.checkboxIds;
      if (this.seekerLogIdArr.length == 0) {
        uni.showToast({
          title: "请选择简历",
          icon: "none",
          duration: 2000,
        });
        return true;
      }
      console.log(this.seekerLogIdArr.length, '长度');
      let form = {
        seekerLogId: this.seekerLogIdArr,
        positionId: this.form.positionId,
        status: value,
        url: this.fileList[0],
        totalMoney: (Number(this.details.startSalary) * 1.15) * this.seekerLogIdArr.length,
        serviceMoney: (Number(this.details.startSalary) * 0.15) * this.seekerLogIdArr.length
      };
      form.url = value === "3" ? this.fileList[0] : "";
      console.log(form);

      exitRecruitsPosition(form).then((res) => {
        this.checkboxIds = [];
        this.pages = 1;
        this.getListFn(1);
        this.workClose();
        uni.showToast({
          title: '确认成功',
          duration: 2000,
          icon: 'none'
        });
      });
    },
    // 批量切换
    batchFn(status) {
      this.batchStatus = status;
    },
    // 选择
    checkboxFn(id, positionId) {
      let index = this.checkboxIds.findIndex((v) => v === id);
      if (index > -1) {
        this.checkboxIds.splice(index, 1);
      } else {
        this.checkboxIds.push(id);
        this.form.positionId = positionId
      }
      console.log(this.checkboxIds);
    },
    // 全选
    checkboxAllFn() {
      if (this.checkboxIds.length === this.list.length) {
        this.checkboxIds = [];
      } else {
        this.checkboxIds = this.list.map((v) => v.seekerLogId);
      }
    },
    // 获取头部详情内容
    getInfo() {
      getRecruitInfo(this.form.positionId).then((res) => {
        console.log(res);
        this.details = res.data;
        if (res.data.positionType == "1") {
          this.$set(this.typeList[5], "categoryName", "已完工");
          this.$set(this.typeList[4], "categoryName", "已到场");
          this.typeList[4].id = '8'
          this.statusOption[3] = "已完工";
          this.statusOption[8] = "已到场";
        }
      });
    },
    // 获取列表
    getListFn(current) {
      let pages = this.pages;
      if (current && current > pages) {
        return true;
      }
      let pageNum = current ? current : 1;
      this.loading = pageNum <= pages ? "loading" : "noMore";
      getJobSeekerLogInfo(this.form)
        .then((res) => {
          let records = res.rows ? res.rows : [];
          records = records.map((v) => {
            v.collect = true;
            return v;
          });
          let newList = pageNum === 1 ? records : [...this.list, ...records];
          this.form.pageNum = pageNum;
          let newPages = Math.floor(res.total / this.form.pageSize);
          this.pages = newPages;
          this.loading = pageNum < newPages ? "more" : "noMore";
          this.list = newList;
          // console.log(this.list);
        })
        .catch((e) => {
          this.loading = "noMore";
        });
    },
    // 切换状态
    tabIndexFn(index, id) {
      this.tabIndex = index;
      this.form.status = id === "100" ? "" : id;
      this.checkboxIds = [];
      this.batchStatus = false;
      this.pages = 1;
      this.getListFn(1);
    },
    // 监听滑动到底部
    scrollBottomFn() {
      let pageNum = this.form.pageNum;
      if (pageNum < this.pages) {
        this.getListFn(pageNum + 1);
      }
    },
    // 联系
    callPhone(phone) {
      uni.makePhoneCall({
        phoneNumber: phone,
      });
    },

    // 提交评价
    commentFn() {
      let params = this.evaluateForm;
      console.log(params);
      evaluate(params).then((res) => {
        this.close();
        this.pages = 1;
        this.getListFn(1);
      });
    },
    //评价
    NowEvaluate(seekerLogId, detail) {
      this.evaluateDetail = detail ? true : false;
      this.evaluateForm.seekerLogId = seekerLogId
        ? [seekerLogId]
        : this.checkboxIds;
      if (detail) {
        getScoreInfo(seekerLogId).then((res) => {
          this.evaluateForm.score = res.data.entScore;
          this.evaluateForm.remark = res.data.entRemark;
          this.evaluateForm.score1 = res.data.userScore;
          this.evaluateForm.remark1 = res.data.userRemark;
        });
      }
      this.$refs.commentPopup.open();
    },
    // 关闭弹窗
    close() {
      this.$refs.commentPopup.close();
      this.evaluateForm = {
        seekerLogId: "",
        score: 0,
        remark: "",
      };
    },

    //已到岗
    workOpen(seekerLogId, positionId) {
      console.log(seekerLogId);
      if (seekerLogId) {
        this.checkboxIds = [seekerLogId];
        this.form.positionId = positionId
      }
      this.$refs.workPopup.open();
    },
    // 到岗记录
    workOpen2(item) {
      this.workUrl = item.url;
      this.$refs.workPopup.open();
    },
    // 关闭弹窗
    workClose() {
      this.$refs.workPopup.close();
      this.workUrl = "";
    },

    onChangeRate() { },

    // 输入框
    sumFontNum(e) {
      this.fontNum = e.detail.value.length;
    },

    // 查看简历
    goDetail(item) {
      uni.navigateTo({
        url: '/subPage/enterprise/home/listDetails/index?id=' + item.seUserId + '&applyStatus=' + item.status
      });
    },
    cancelHere() {
      this.$refs.confirmPopup.close();
    },
    confirmHere() {
      let value = '8'
      this.seekerLogIdArr = this.hereSeekerLogId ? [this.hereSeekerLogId] : this.checkboxIds;
      if (this.seekerLogIdArr.length == 0) {
        uni.showToast({
          title: "请选择简历",
          icon: "none",
          duration: 2000,
        });
        return true;
      }
      console.log(this.seekerLogIdArr.length, '长度');
      let form = {
        seekerLogId: this.seekerLogIdArr,
        positionId: this.form.positionId,
        status: '8',
        code: this.messageCode,
        url: this.fileList[0],
        totalMoney: (Number(this.details.startSalary) * 1.15) * this.seekerLogIdArr.length,
        serviceMoney: (Number(this.details.startSalary) * 0.15) * this.seekerLogIdArr.length
      };
      form.url = value === "3" ? this.fileList[0] : "";
      console.log(form);

      exitRecruitsPosition(form).then((res) => {
        this.$refs.confirmPopup.close();
        this.checkboxIds = [];
        this.pages = 1;
        this.getListFn(1);
        this.workClose();
        uni.showToast({
          title: '确认成功',
          duration: 2000,
          icon: 'none'
        });
      });
    }
  },
};
</script>
<style lang="scss" scoped>
.workUrl {
  width: 558rpx;
  height: 692rpx;
  display: block;
  margin: 0 auto 25rpx;
}

.scroll-main {
  position: relative;
  // height: calc(100vh - 178rpx);
  height: calc(100vh - 86rpx);
  box-sizing: border-box;
  padding: 0 0 30rpx;
}

.bottom-btn {
  display: flex;
  // justify-content: flex-end;
  margin-top: 20rpx;
  margin-right: 24rpx;
  padding-bottom: 20rpx;

  .text1 {
    height: 64rpx;
    line-height: 64rpx;
    font-size: 24rpx;
    color: rgba(0, 0, 0, 0.64);
    font-weight: 500;
    padding: 0 24rpx;
  }

  .btn1 {
    min-width: 120rpx;
    height: 64rpx;
    font-size: 24rpx;
    color: #000000;
    line-height: 64rpx;
    text-align: center;
    border: 1rpx solid #0000001f;
    border-radius: 44rpx;
    margin-left: 10rpx;
    padding: 0 18rpx;
    box-sizing: border-box;
  }
}

.list {
  margin-top: 30rpx;
  background-color: #f9f9f9;

  .label-item {
    display: flex;
    align-items: center;
    margin: 0 24rpx 16rpx 24rpx;

    .checkbox {
      width: 76rpx;
      height: 76rpx;
      margin-left: -24rpx;
      display: flex;
      justify-content: center;
      align-items: center;

      &::after {
        content: "";
        width: 28rpx;
        height: 28rpx;
        display: block;
        border: 2rpx solid #d7d7d7;
        box-sizing: border-box;
        border-radius: 50%;
      }

      &.active::after {
        border: 8rpx solid #ff9f24;
      }
    }
  }

  .list-item {
    flex: 1;
    // height: 248rpx;
    background-color: #fff;
    border-radius: 16rpx;

    // margin: 24rpx 24rpx 31rpx;
    .top-box {
      display: flex;
      justify-content: space-between;
      width: 100%;
      height: 50%;
      margin-top: 32rpx;

      .left-item {
        padding-top: 24rpx;
        padding-left: 24rpx;
        display: flex;
        height: 100%;

        .image {
          width: 96rpx;
          height: 96rpx;
          margin-right: 16rpx;
          background: #eee;

          image {
            width: 100%;
            height: 100%;
          }
        }

        .desc-box {
          display: flex;
          flex-direction: column;

          .t-desc {
            display: flex;
            margin-top: 16rpx;

            .name {
              height: 40rpx;
              line-height: 40rpx;
              font-weight: 500;
              font-size: 28rpx;
              color: #000000e0;
              margin-right: 12rpx;
              margin-bottom: 12rpx;
            }

            .icon {
              margin-right: 12rpx;

              image {
                width: 24rpx;
                height: 24rpx;
                background: #eee;
              }
            }

            .status {
              width: 82rpx;
              height: 32rpx;
              text-align: center;
              line-height: 32rpx;
              background: #f3f3f3;
              border-radius: 8rpx;
              font-weight: 500;
              font-size: 18rpx;
              color: rgba(0, 0, 0, 0.64);

              &.active {
                color: #9b7748;
                background: #ffebd1;
              }
            }
          }

          .b-desc {
            display: flex;

            .text {
              color: #00000073;
              opacity: 0.45;
              font-size: 24rpx;

              font-weight: 500;

              text-align: left;
            }
          }
        }
      }

      .right-item {
        padding-top: 32rpx;

        .label {
          position: absolute;
          right: 45rpx;
          width: 120rpx;
          height: 42rpx;
          background: #34a1ff;
          border-radius: 6rpx;
          font-weight: 500;
          font-size: 22rpx;
          color: #ffffff;
          text-align: center;
          line-height: 42rpx;
          margin-bottom: 10rpx;
        }

        .address {
          font-weight: 500;
          font-size: 24rpx;
          color: #00000073;
          margin-right: 24rpx;
        }
      }
    }

    .line {
      margin: 24rpx 24rpx 26rpx;
      height: 2rpx;
      background-color: #eeeeef;
    }

    .bottom-box {
      display: flex;
      justify-content: space-between;
      padding-left: 24rpx;
      padding-right: 24rpx;
      align-items: center;

      .b-left {
        flex: 1;

        .one {
          font-weight: 500;
          font-size: 22rpx;
          line-height: 45rpx;
          color: rgba(0, 0, 0, 0.45);
          display: inline-block;
          vertical-align: top;
        }

        .tow {
          padding-left: 20rpx;
          height: 45rpx;
          line-height: 45rpx;
          font-weight: 500;
          font-size: 28rpx;
          color: #000000;
          opacity: 0.64;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
          width: 350rpx;
          display: inline-block;
          vertical-align: top;
        }
      }

      .b-right {
        flex-shrink: 0;

        .symbol {
          color: #000000;
          margin-right: 6rpx;
        }

        .money {
          color: #ff9e24;
          font-size: 34rpx;
          font-weight: 500;
          text-align: left;
        }
      }
    }
  }
}

.flex1 {
  flex: 1;
}

.main-head {
  background: #ffffff;
  padding: 0 24rpx;

  .title-h3 {
    font-size: 32rpx;
    color: #000000;
    line-height: 80rpx;
  }

  .price-wall {
    display: flex;

    .tag {
      height: 40rpx;
      font-size: 22rpx;
      color: #ffffff;
      line-height: 40rpx;
      background: #34a1ff;
      border-radius: 6rpx;
      padding: 0 14rpx;
      display: inline-block;
    }

    .price-text {
      font-size: 24rpx;
      color: rgba(0, 0, 0, 0.64);
      font-weight: 500;

      .price-strong {
        font-size: 32rpx;
        color: #ff9e24;
      }
    }
  }

  .num-wall {
    display: flex;
    height: 136rpx;
    background: rgba(216, 216, 216, 0.16);
    border-radius: 8rpx;
    padding-top: 22rpx;
    box-sizing: border-box;
    margin-top: 32rpx;

    .num-item {
      flex: 1;
      font-size: 24rpx;
      color: rgba(0, 0, 0, 0.45);
      text-align: center;
      line-height: 34rpx;

      .strong {
        font-size: 36rpx;
        color: #000000;
        font-weight: bolder;
        line-height: 50rpx;
      }
    }
  }

  .state-bar {
    display: flex;
    line-height: 34rpx;
    padding: 22rpx 0 32rpx;

    .state {
      font-size: 24rpx;
      color: #317ed0;
      font-weight: 500;
      flex: 1;
    }

    .time {
      display: flex;
      font-weight: 500;
      font-size: 24rpx;
      color: rgba(0, 0, 0, 0.45);
      align-items: center;

      .time-icon {
        width: 24rpx;
        height: 24rpx;
        margin-right: 7rpx;
      }
    }
  }
}

.tabNav-wall {
  position: relative;
  // position: fixed;
  // left: 0;
  width: 100%;
  z-index: 10;
  background: #f8f8f8;
}

.tabNavH {
  height: 86rpx;
}

.tabNav {
  white-space: nowrap;
  width: 100%;
  height: 100%;
  padding: 0 24rpx;
  box-sizing: border-box;

  .tabNav-item {
    position: relative;
    font-weight: 900;
    font-size: 28rpx;
    color: rgba(0, 0, 0, 0.45);
    display: inline-block;
    line-height: 45rpx;
    padding: 18rpx 24rpx 23rpx;
    margin-right: 8rpx;

    .tabNav-icon {
      position: absolute;
      right: 0;
      left: 0;
      bottom: 0;
      width: 37rpx;
      height: 16rpx;
      margin: auto;
      display: none;
    }

    &.active {
      color: rgba(0, 0, 0, 0.88);
      font-size: 32rpx;

      .tabNav-icon {
        display: block;
      }
    }
  }
}

.operate-wallH {
  height: 92rpx;
}

.operate-wall {
  position: absolute;
  left: 0;
  top: 86rpx;
  width: 100%;
  display: flex;
  justify-content: flex-end;
  padding: 18rpx 24rpx;
  height: 92rpx;
  box-sizing: border-box;
  background: #f8f8f8;
  z-index: 10;

  .operate-item {
    min-width: 130rpx;
    height: 56rpx;
    font-size: 24rpx;
    padding: 0 22rpx;
    color: rgba(0, 0, 0, 0.45);
    background: rgba(216, 216, 216, 0.36);
    border-radius: 44rpx;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 24rpx;
    box-sizing: border-box;

    &.active {
      color: #ffffff;
      background: #ff9e24;
    }

    .operate-icon {
      width: 24rpx;
      height: 24rpx;
      margin-right: 8rpx;
    }
  }
}

.footer-operateH {
  height: 140rpx;
  padding-bottom: env(safe-area-inset-bottom);
  box-sizing: border-box;
}

.footer-operate {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 140rpx;
  display: flex;
  // justify-content: center;
  align-items: center;
  background: #ffffff;
  border-radius: 24rpx 24rpx 0rpx 0rpx;
  padding: 25rpx 30rpx;
  padding-bottom: env(safe-area-inset-bottom);
  box-sizing: border-box;

  .footer-text {
    font-size: 32rpx;
    color: #8c8c8c;
    font-weight: 500;
    // margin-left: 30rpx;
  }

  .footer-btn {
    width: 160rpx;
    height: 68rpx;
    font-size: 28rpx;
    color: #000000;
    line-height: 68rpx;
    text-align: center;
    background: rgba(216, 216, 216, 0.24);
    border-radius: 50rpx;
    margin-left: 12rpx;

    &.active {
      color: #ffffff;
      background: #ff9e24;
    }
  }
}

.dialog {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 670rpx;
  height: 950rpx;
  background-image: linear-gradient(180deg,
      #fff6eb 1%,
      #ffffff 6%,
      #ffffff 100%);
  border-radius: 32rpx;
  overflow: auto;

  .dialogTop {
    display: flex;
    justify-content: space-between;
    padding: 32rpx;

    .title {
      font-weight: 500;
      font-size: 36rpx;
      color: #000000e0;
      letter-spacing: 0;
    }

    .close {
      width: 48rpx;
      height: 48rpx;

      image {
        width: 100%;
        height: 100%;
      }
    }
  }

  .btn {
    display: flex;
    align-items: center;
    justify-content: space-between;

    width: 100%;

    .finish {
      width: 240rpx;
      height: 80rpx;
      background: #ff9e24;
      border-radius: 44rpx;
      line-height: 80rpx;

      font-weight: 500;
      font-size: 28rpx;
      color: #ffffff;
      text-align: center;
      margin-right: 80rpx;
    }

    .later {
      width: 240rpx;
      height: 80rpx;
      background: #d8d8d83d;
      border-radius: 44rpx;
      line-height: 80rpx;
      font-weight: 500;
      font-size: 28rpx;
      color: #000000e0;
      text-align: center;
      margin-left: 80rpx;
    }
  }

  .content {
    display: flex;
    // width: 100%;
    flex-direction: column;

    justify-content: flex-start;
    margin-left: 32rpx;

    .text {
      font-weight: 900;
      font-size: 32rpx;
      color: #000000e0;
    }

    .textarea-text {
      font-size: 26rpx;
      color: #333333;
      line-height: 38rpx;
      word-break: break-all;
      word-wrap: break-word;
    }

    .textarea {
      position: relative;
      width: 606rpx;
      height: 318rpx;
      background: #f9f9f9;
      border-radius: 16rpx;

      .textarea-num {
        position: absolute;
        right: 20rpx;
        bottom: 16rpx;
        font-size: 22rpx;
        color: rgba(0, 0, 0, 0.45);
        text-align: right;
      }
    }
  }
}

.payPopup {
  width: 600rpx;
  height: 630rpx;
  background: #fff;
  padding: 32rpx;
  box-sizing: border-box;
  font-size: 28rpx;
  color: #000000e3;
  border-radius: 20rpx;

  .p_contain {
    width: 100%;

    .c_header {
      display: flex;
      justify-content: center;
      align-items: center;
      position: relative;
      font-size: 32rpx;
      margin-bottom: 30rpx;

      image {
        position: absolute;
        width: 48rpx;
        height: 48rpx;
        right: 0;
        top: 0;
      }
    }

    .c_item {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin: 40rpx 0;
    }

    .c_hide {
      color: rgba(0, 0, 0, 0.3);
    }

    .c_confirm {
      text-align: center;
      font-size: 32rpx;
      margin-top: 80rpx;
      font-weight: 700;
    }
  }
}

.confirmBox {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 600rpx;
  height: 400rpx;
  background: #fff;
  border-radius: 10rpx;
  padding: 24rpx;
  box-sizing: border-box;

  .top {
    width: 100%;
    text-align: center;
    font-size: 32rpx;
    margin-bottom: 30rpx;
  }

  .middle {
    font-size: 28rpx;
    color: #000000e3;
    padding: 0 24rpx;
    box-sizing: border-box;
    margin-bottom: 30rpx;
  }

  .input {
    width: 100%;
    height: 50rpx;
    display: flex;
    justify-content: center;
    margin-bottom: 60rpx;

    input {
      width: 400rpx;
      height: 100%;
      border: 1px solid #317ed0;
      border-radius: 10rpx;
    }
  }

  .btn {
    width: 100%;
    display: flex;
    justify-content: center;

    .confirm {
      width: 160rpx;
      height: 60rpx;
      background: #ff9e24;
      border-radius: 44rpx;
      line-height: 60rpx;

      font-weight: 500;
      font-size: 24rpx;
      color: #ffffff;
      text-align: center;
      margin-right: 80rpx;
    }

    .cancel {
      width: 160rpx;
      height: 60rpx;
      background: #d8d8d83d;
      border-radius: 44rpx;
      line-height: 60rpx;
      font-weight: 500;
      font-size: 24rpx;
      color: #000000e0;
      text-align: center;
      margin-left: 80rpx;
    }
  }
}
</style>
